import axios from "axios";
const request = axios.create({
  //配置基础请求的路径
  baseURL: import.meta.env.VITE_APP_BASE_API,

});

export function dityList(status,namekw="",cp="1",ls="10",) {
  return request.post("details/list", {
    cp, //当前页
    ls, //每页的长度
    namekw, //根据名字进行模糊查询的条件
    status, //是否上架（0是上架，1是未上架）
  });
}
// 添加商品
export function dityeve(info,price) {
  return request.post("details/save", {
    mobileEndCommodityid: 2,

    oldPrice: 10,

    discount: 0,

    sellCount: 2,

    alreadsell: 2,

    urlImage: "scscsc",

    info,

    origin: "四川",

    evaluation: 3,

    sevenDays: 0,

    commodityNumber: "1002",

    state: 1,

    createTime: "2022-12-14 00:00:00",

    updateTime: "2022-12-14 00:00:00",

    type: 1,

    aftermarket: 0,

    price,

    views: 2,
  });
}

// 修改商品
export function xuigai(id , info,state) {
  return request.post("details/update", {
    id,

    mobileEndCommodityid: 2,

    oldPrice: 10,

    discount: 0,

    sellCount: 2,

    alreadsell: 2,

    urlImage: "scscsc",

    info,

    origin: "四川",

    evaluation: 3,

    sevenDays: 0,

    commodityNumber: "1002",

    state,

    createTime: "2022-12-14 00:00:00",

    updateTime: "2022-12-14 00:00:00",

    type: 1,

    aftermarket: 0,

    price: 10,

    views: 2,
  });
}
// 删除
export function shangchu (id){
    return request.delete("details/remove/"+id)
}